<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>发布</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui/aui.css" />
    <style>
        .aui-bar-nav {
            background: #0689FB;
        }

        .col_flex {
            height: calc(100vh-4rem);
            background: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }

        .btn {
            width: 60vw;
            height: 17vw;
        }
    </style>
</head>

<body>

    <div id="app">
        <header class="aui-bar aui-bar-nav">发布</header>
        <div class="col_flex">
            <img class="btn" src="../../image/img/btn_img1.png" @click="checkUser('profess_publish')" style="margin:4rem 0;" alt="">
            <img class="btn" src="../../image/img/btn_img2.png" @click="checkUser('odd_job')" alt="">
        </div>
    </div>
</body>
<script src="../../script/api.js" charset="utf-8"></script>
<script src="../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../script/common/common.js" charset="utf-8"></script>
<script src="../../script/common/config.js" charset="utf-8"></script>
<script src="../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();

    }

    var vm = new Vue({
        el: "#app",
        data: {
            userInfo: {}
        },
        methods: {
            init() {
                api.execScript({
                    frameName: 'my',
                    script: 'vm.gerUserInfo()'
                });
                this.userInfo = get_local('userInfo');
                this.statusBar();
            },
            checkUser(name) {
                if (this.userInfo.user_status === 1) {
                    $toast("请先完善基本资料");
                } else {
                    this.openWin(name);
                }
            },
            openWin(type) {
                let winInfo = {
                    profess_publish: {
                        name: 'profess_publish_win',
                        url: './profess_publish_win.html'
                    },
                    odd_job: {
                        name: 'odd_job_win',
                        url: './odd_job_win.html'
                    }
                };
                open_w(winInfo[type].name, winInfo[type].url);
            },
            statusBar() {
                //沉浸式状态栏
                var systemType = api.systemType;
                var statusBar = api.require('statusBar');
                if (systemType == "ios") {
                    if (navigator.userAgent.indexOf("iPhone") != -1) {
                        $("header").css({
                            "paddingTop": api.safeArea.top + 'px'
                        });
                    }
                } else {
                    statusBar.getStatusBarHeight(function(ret, err) {
                        $("header").css({
                            "paddingTop": ret.statusHeight
                        });
                    });
                }
            },
        }
    });
</script>

</html>
